package com.hexb.smh.service;

import com.hexb.core.common.Page;
import com.hexb.smh.entity.Product;
import com.hexb.smh.entity.ProductRaw;
import com.hexb.smh.entity.enums.ImportStrategy;
import com.hexb.smh.entity.param.product.ProductQueryParam;
import com.hexb.smh.entity.view.ImportResult;
import com.hexb.smh.entity.view.ProductBrandView;
import com.hexb.smh.entity.view.ProductClientView;
import com.hexb.smh.entity.view.ProductView;
import org.springframework.web.multipart.MultipartFile;

import javax.validation.constraints.NotNull;
import java.io.OutputStream;
import java.util.List;
import java.util.Map;

/**
 * @author : hexb
 */
public interface IProductService {

    Product save(Product product);

    int update(Product product);

    Page<ProductView> search(ProductQueryParam param, int pageSize, int pageNum);

    List<ProductView> search(String searchKey);

    ProductView selectOneById(Integer id);

    int delete(Integer id);

    int deleteBatch(Integer[] ids);

    int toggleActivated(Integer id, Boolean activated);

    ProductRaw findOneByMap(Map<?, ?> param);

    int updateActivatedBatch(Integer[] ids, Boolean activated);

    Page<ProductClientView> searchClient(@NotNull Integer brandId, String searchKey, int pageSize, int pageNum);

    List<ProductClientView> searchClient(@NotNull Integer brandId, String searchKey);

    ImportResult<Product> importProduct(MultipartFile file, ImportStrategy strategy);

    void export(OutputStream os);

    List<ProductBrandView> findWithBrandId(Integer brandId,
                                           Integer[] ids,
                                           Boolean activated,
                                           String searchKey);

    List<Product> listByIds(Integer[] ids);

}
